﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MultiAnnotatedRegex.tree {
	abstract class TreeVisitor {
		public void Visit(Tree tree) {
			tree.AcceptVisitor(this);
		}

		virtual public void VisitLiteral(LiteralTree literalTree) {	}

		virtual public void VisitConcat(ConcatTree concatTree) {
			foreach (Tree child in concatTree.Children) {
				Visit(child);
			}
		}

		virtual public void VisitOneOf(OneOfTree oneOfTree) {
			foreach (Tree child in oneOfTree.Children) {
				Visit(child);
			}
		}

		virtual public void VisitRepetition(RepetitionTree repetitionTree) {
			Visit(repetitionTree.Inner);
		}

		virtual public void VisitAnyTree(premade.AnyTree anyTree) { }

		virtual public void VisitCharacterClass(premade.CharacterClassTree characterClassTree) { }
	}
}
